package com.shuhua.taskServer.controller;

import com.shuhua.common.result.Result;
import com.shuhua.pojo.dto.CraftsmanAuthDTO;
import com.shuhua.pojo.dto.CraftsmanUpdateDTO;
import com.shuhua.pojo.vo.CraftsmanVO;
import com.shuhua.taskServer.service.CraftsmanService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/craftsman")
public class CraftsmanController {

    @Autowired
    private CraftsmanService craftsmanService;

    @GetMapping("/info")
    public Result<CraftsmanVO> getInfo() {
        return Result.success(craftsmanService.getInfo());
    }
    @PutMapping("/update")
    public Result<?> updateInfo(@RequestBody CraftsmanUpdateDTO updateDTO) {
        craftsmanService.updateInfo(updateDTO);
        return Result.success(null);
    }

    @PostMapping("/authenticate")
    public Result<?> submitAuthentication(@RequestBody CraftsmanAuthDTO authDTO) {
        craftsmanService.submitAuthentication(authDTO);
        return Result.success(null);
    }
}